home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / bprof-1.1 / bprof-1 / bprof / Makefile < prev    next >
Encoding:
Makefile  |  1994-07-13  |  2.2 KB  |  91 lines

  1. # The sources to the bprof program I made myself
  2. MYSRCS = bprof.cc execute.cc bmonout.cc sources.cc
  3. MYHDRS = execute.h bmonout.h sources.h
  4. MYOBJS = bprof.o execute.o bmonout.o sources.o
  5.  
  6. # The sources of bprof made by genclass from libg++
  7. # Put them in an archive as advised in the manual.
  8. GSRCS = String.sfpnt.VHMap.cc String.sfpnt.Map.cc
  9. GHDRS = String.sfpnt.VHMap.h String.sfpnt.Map.h String.defs.h
  10. # Needed to truncate these names or ar would map them to
  11. # the same name.  How stupid.
  12. GOBJS = VHMap.o Map.o
  13.  
  14. # The sources to libbmon.a
  15. LIBSRCS = bmon.c
  16. LIBHDRS =
  17. LIBOBJS = bmon.o
  18.  
  19. PROG = bprof
  20. # I first used the lib(file.o) feature of make, but this turned
  21. # out to be recent, so not everywhere present.
  22. BLIB = libbmon.a
  23. GLIB = libgpp.a
  24.  
  25. CC = gcc
  26. CXX = g++
  27. # I like -Wshadow, but the $(GSRCS) files generate too many
  28. # warnings with it.
  29. CFLAGS = -Wall -O2
  30. CXXFLAGS = -Wall -O2
  31.  
  32. INSTALL = install
  33. PREFIX = /usr
  34. BINDIR = $(PREFIX)/bin
  35. LIBDIR = $(PREFIX)/lib
  36. MANDIR = $(PREFIX)/man/man1
  37.  
  38. all: $(PROG) $(BLIB)
  39.  
  40. .PHONY: clean
  41.  
  42. # Somewhat weird rule to fool make into not remaking depend every
  43. # time I make a small change to a source file.  This gets only
  44. # executed if I explicitly "make depend".
  45. depend::
  46.     gcc -M $(MYSRCS) $(LIBSRCS) $(GSRCS) > $@
  47.  
  48. $(PROG): $(MYOBJS) $(GLIB)
  49.     $(CXX) -o $@ $(MYOBJS) $(GLIB)
  50.  
  51. # Make sure bmon.c is compiled with -g
  52. bmon.o: bmon.c
  53.     $(CC) -g $(CFLAGS) -c $<
  54.  
  55. VHMap.o: String.sfpnt.VHMap.o
  56.     ln -f $< $@
  57.  
  58. Map.o: String.sfpnt.Map.o
  59.     ln -f $< $@
  60.  
  61. $(GLIB): $(GOBJS)
  62.     ar r $@ $?
  63.  
  64. $(BLIB): $(LIBOBJS)
  65.     ar r $@ $?
  66.  
  67. bprof.cat: bprof.1
  68.     groff -Tascii -ww -man $< > $@
  69.  
  70. # Using GNU install -d would also create the lib/man
  71. # directories with mode 644.  Weird.
  72. install: $(PROG) $(BLIB)
  73.     mkdir -p $(BINDIR) $(LIBDIR) $(MANDIR)
  74.     $(INSTALL) -s -m 755 $(PROG) $(BINDIR)
  75.     $(INSTALL) -m 644 $(BLIB) $(LIBDIR)
  76.     $(INSTALL) -m 644 bprof.1 $(MANDIR)
  77.  
  78. clean:
  79.     rm -f *.o $(PROG) $(GLIB) $(BLIB) core
  80.  
  81. # All non-source files to distribute
  82. TEXT = README bprof.1 bprof.cat Makefile depend bprof.lsm version COPYING NEWS
  83. DIST = $(TEXT) $(MYSRCS) $(MYHDRS) $(LIBSRCS) $(LIBHDRS) $(GSRCS) $(GHDRS)
  84. VERSION = $(shell cat version)
  85.  
  86. # I can't stand tar files that unpack in the current directory
  87. tar:    $(DIST)
  88.     tar -z -f bprof-$(VERSION).tar.gz -C .. -c $(addprefix bprof/,$^)
  89.  
  90. include depend
  91.